package furns.dao.impl;

import furns.dao.BasicDAO;
import furns.dao.OrderDAO;
import furns.entity.Order;

import java.util.List;

public class OrderDAOImpl extends BasicDAO<Order> implements OrderDAO {
    @Override
    public int saveOrder(Order order) {
        String sql = "insert into `order` (`id`,`create_time`,`price`,`status`,`member_id`) values(?,?,?,?,?)";
        return update(sql, order.getId(), order.getCreateTime(), order.getPrice(), order.getStatus(), order.getMemberId());
    }

    @Override
    public List<Order> queryOrderByMemberId(Integer memberId) {
        String sql = "select id,create_time,\n" +
                "       price,status,member_id from `order` where member_id = ?";
        return queryMulti(sql, Order.class, memberId);
    }
}
